﻿using UnityEngine;
using System.Collections;

/// 标准型单利
//public class Singleton
//{
//    private static Singleton _instance = new Singleton();
//    private Singleton() { }
//    public static Singleton Instance
//    {
//        get
//        {
//            return _instance;
//        }
//    }
//}

/// 泛型单利
public class Singleton<T> where T : new()
{
    static T _instance;

    static Singleton()
    {
        _instance = new T();
    }

    public static T instance
    {
        get
        {
            return _instance;
        }
    }

}
